<!doctype html>
<html class="no-js">

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>激活码库存</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<meta name="mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-title" content="Amaze UI" />
	<meta name="msapplication-TileColor" content="#0e90d2">
	<link rel="stylesheet" href="assets/css/amazeui.min.css">
	<link rel="stylesheet" href="assets/css/app.css">
	<style>
		.onclic {
			background: #0165C7;
			color: #fff;
			display: inline-block;
			width: 35px;
			height: 35px;
			text-align: center;
			line-height: 33px;
			font-size: 16px;
			cursor: pointer;
		}

		input::-webkit-outer-spin-button,
		input::-webkit-inner-spin-button {
			-webkit-appearance: none;
		}

		input[type="number"] {
			-moz-appearance: textfield;
		}
	</style>
</head>

<body style="background: #f8f8f8;">
	<!-- 页面内容 开发时删除 -->
	<div id="" class="am-container">

		<div class="am-u">
			<div class="am-u-sm-12 bg-beij am-text-center h50">
				<div style="color: #fff;">
					<a href="Activationcode.html" style="margin-left:10px;" class="am-fl">
						<img src="img/back.png" width="50%" />
					</a>
					激活码库存
					<div class="am-fr" style="margin-right:10px;">
						<a href="record.html">
							<span style="color: #fff;">库存记录</span>
						</a>
					</div>
				</div>
			</div>
		</div>
		<div class="am-u">
			<div class="am-u-sm-12">
				<div class="bg-white am-text-center" style="padding: 10px 0;">
					<div style="width: 40%;display: inline-block;position: relative;">
						<img src="img/group.png" class="" width="100%" />
						<div id="code_num" style="position: absolute;bottom:25%;left:25%;width: 50%;color:#fff;">0</div>
					</div>

				</div>
			</div>
			<div class="am-u-sm-12">
				<p style="margin: 0;background: #fff;font-size: 14px;padding-left: 15px;">激活码生成</p>
			</div>
			<div class="am-u-sm-12 bg-white" style="padding:15px 15px;">
				<div class="am-u-sm-12" style="height: 40px;padding-left:10px;">
					收码人：
					<input type="text" id="to_login_name" style="width: 50%;border: none;" />
					<img src="img/ActiveCode_aa@2x.png" style="float: right;width:20px;padding-top: 3px;" alt="" />
				</div>
				<div class="am-u-sm-12" style="height: 40px;padding-top: 5px;">
					<div class="am-u-sm-4">
						转让数量
					</div>
					<div class="am-u-sm-8 am-text-right">
						<span class="onclic" onclick="onclic(this)">-</span>
						<input type="number" value="0" name="num" style="display: inline-block;width: 40%;height:35px;text-align: center;" id="code_num1"
						/>
						<span class="onclic" onclick="onclic(this)">+</span>
					</div>
				</div>


			</div>
		</div>
		<div class="am-u">
			<div class="am-u-sm-12 bg-white" style="margin:20px 0;text-align: center;">
				<button type="button" id="activate_btn" style="background: #0165C7;color:#fff;border: 0;width:80%;height:35px;line-height: 33px;border-radius: 10px;">提交</button>
			</div>
		</div>
	</div>
	<!-- 以上页面内容 开发时删除 -->

	<!--[if (gte IE 9)|!(IE)]><!-->
	<script src="assets/js/jquery.min.js"></script>
	<!--<![endif]-->
	<script src="assets/js/amazeui.min.js"></script>
	<script src="js/loading.js"></script>
	<script src="js/comp.js"></script>
	<script>
		$("#code_num").html(sessionStorage['code_num']);
		$("#activate_btn").on("click", function () {
			var token1 = sessionStorage['token'];
			var method1 = "InvitationCode|tranfer";
			var to_login_name1 = $("#to_login_name").val();
			var code_num2 = $("#code_num1").val();
			if (to_login_name1 == "" || to_login_name1 == null) {
				alert("请输入收码人");
				return false;
			}
			if (code_num2 == 0) {
				alert("请选择转让数量");
				return false;
			}
			$.ajax({
				type: 'POST',
				url: "http://www.rice.com/app/api/h5_access",
				contentType: "application/x-www-form-urlencoded; charset=utf-8",
				datatype: "JSON",
				data: {
					method: method1,
					token: token1,
					to_login_name: to_login_name1,
					code_num: code_num2
				},
				success: function (data) {
					var data1 = JSON.parse(data);
					if (data1.status === 1) {
						var hh1 = sessionStorage['code_num'];
						sessionStorage['code_num'] = Number(hh1) - Number(code_num2);
						$("#code_num").html(sessionStorage['code_num']);
						alert(data1.message);
					} else if (Number(data1.status) == 2) {
						alert(data1.message);
						window.location.href = "login.html";
					} else {
						alert(data1.message);
					}
				}
			});
		})
	</script>
</body>

</html>